package com.ruicar.afs.cloud.apply.admin.manage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruicar.afs.cloud.apply.admin.manage.condition.ApplyUserCondition;
import com.ruicar.afs.cloud.apply.admin.manage.entity.*;
import com.ruicar.afs.cloud.common.modules.apply.enums.CarTypeEnum;
import org.apache.ibatis.annotations.Param;

import java.util.List;


/**
 * @author xudongdong
 * @date 2020-06-03
 */
public interface ApplyUserMapper extends BaseMapper<SysUser> {

    List<SysRole> listRolesByUserId(@Param("id") Long id, @Param("businessType") CarTypeEnum businessType);

    List<SysRole> listRolesByUserIdTemp(@Param("id") Long id, @Param("businessType") CarTypeEnum businessType);

    List<SysAppertainRegion> findAppertainByUserId(Long id);

    List<SysAppertainRegion> findAuthorizeByUserId(Long id);

    List<String> findUserName(@Param("userName") String userName);

    List<SysChannelWitnessInfo> getWitnessList(@Param("sp") String sp, @Param("identityNumber") String identityNumber);

    Integer findUserCount(@Param("businessType") String businessType, @Param("channelId") Long channelId);

    Integer findUserCountByDepart(@Param("businessType") String businessType, @Param("channelId") Long channelId,@Param("ids") List<Long> ids);

    Integer findUserCountNotInUser(@Param("businessType") String businessType, @Param("channelId") Long channelId,@Param("ids") List<Long> ids);

    Integer findUserCountNotInUserTemp(@Param("businessType") String businessType, @Param("channelId") Long channelId,@Param("ids") List<Long> ids);



    /**
     * 获取部门下区域信息
     *
     * @param username
     * @param businessType
     * @param parentId
     * @return
     */
    List<SysDeptAuthRegion> getDeptAddressList(@Param("username") String username, @Param("businessType") CarTypeEnum businessType, @Param("parentId") String parentId);

    /**
     * 获取所有用户角色
     *
     * @param id
     * @return
     */
    List<SysRole> listRolesInfo(@Param("id") Long id);

    /**
     * 同部门和同角色的用户
     *
     * @param condition
     * @return
     */
    List<SysUser> getTransferUser(@Param("query") ApplyUserCondition condition,@Param("ids") List<Long> ids);
}
